<html> 
<body> 
<h3> 
	Case Summary DTD Validation 
</h3> 
	 
<script type="text/javascript"> 
 
	var xmlFile = prompt("Please enter the name of the XML file to validate.","books.xml"); 
	 
	 
	if (xmlFile) 
	{ 
	    var xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); 
	 
	    with (xmlDoc) 
	    { 
	        xmlDoc.async = false; 
	        xmlDoc.validateOnParse = true; 
	        xmlDoc.load(xmlFile); 
	    } 
	 
	    with (document) 
	    { 
	        if ( xmlDoc.parseError.errorCode ) 
	        { 
	            document.fgColor = "red"; 
	 
	            write("XML document \"" + xmlFile + "\" is improperly formatted according to DTD specifications."); 
	            write("<br/><br/>Error Code: "); 
	            write(xmlDoc.parseError.errorCode); 
	            write("<br/>Error Reason: "); 
	            write(xmlDoc.parseError.reason); 
	            write("<br/>Error Line: "); 
	            write(xmlDoc.parseError.line); 
	        } 
	        else 
	        { 
				document.fgColor = "black"; 
				write("XML document \"" + xmlFile + "\" conforms to DTD specifications."); 
			} 
		} 
	} 
	else 
	{ 
		document.write("Couldn't open the XML file."); 
	} 
 
</script> 
 
</body> 
</html> 